<template>
  <el-select class="bid-method" :value="value" :disabled="disabled" :placeholder="placeholder" @change="prjectChanged">
    <el-option v-for="item in project" :key="item.id" :label="item.project_name" :value="item.uu_id"></el-option>
  </el-select>
</template>

<script>
import {getVideoProject} from '../api'
export default {
  name: "ProjectSelect",
  props: {
    value: [String, Number],
    disabled:{
      type: Boolean,
      default: false,
    },
    placeholder:{
      type: String,
      default: "请选择项目名称",
    }
  },
  model: {
    prop: "value",
    event: "change"
  },
  data() {
    return {
      project: []
    };
  },
  created() {
    this.getVideoProject();
  },
  methods: {
    prjectChanged(id) {
      this.$emit("change", id);
    },
    async getVideoProject() {
        let {data} = await getVideoProject();
        if(data.errno === 0){
            this.project = data.project;
        }else{
            this.$message({
                type: 'warning',
                message: data.message
            })
        }
    }
  }
};
</script>

<style lang="scss">
  .bid-method{
    width: 100%;
  }
</style>